# Importing Data
LATIN<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Plastic/Plastics.xlsx",sheet = "Sheet1", range = "c1:c70")

# Checking the Imported Data
View(LATIN)
# Creating Time Series Data
LATIN_ts <- ts(LATIN, start=c(2006), end=c(2018), frequency=1)
# Viewing and Checking the Created Time Series Data
LATIN_ts
sum(is.na(LATIN_ts))
library(forecast)

LATIN_ts <- tsclean(LATIN_ts)
LATIN_ts

# Identification: Plotting the Time Series Data
plot(LATIN_ts)

# Estimating the appropriate model
LATIN_ts_model <- auto.arima(LATIN_ts)
LATIN_ts_model

# Forecasting
options(max.print=1000000)
LATIN_ts_forecast <- forecast (LATIN_ts_model, level=c(95), h=22)
plot(LATIN_ts_forecast)
LATIN_ts_forecast             

# Exporting
write.table(LATIN_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Plastic/LATIN_TSA.csv", sep=",")


